package com.authine.cloudpivot.web.api.controller;

import com.authine.cloudpivot.engine.api.model.organization.RoleModel;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import com.authine.cloudpivot.web.api.service.CustomExcelService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: zyj
 * @time: 2022/2/16 13:46
 */
@RestController
@RequestMapping("/api/customExcel")
@Slf4j
public class CustomExcelController extends BaseController {

    @Autowired
    private CustomExcelService customExcelService;

    @ApiOperation(value = "获取招聘组组名" )
    @GetMapping("/getRecruitmentGroup")
    @ResponseBody
    public List<String> getRecruitmentGroup(){

        String userId = getUserId();
        List<String> userIds = new ArrayList<>();
        userIds.add(userId);
        Map<String, List<RoleModel>> rolesByUserIds = getOrganizationFacade().getRolesByUserIds(userIds);
        if(MapUtils.isNotEmpty(rolesByUserIds)) {
            List<RoleModel> roles = rolesByUserIds.get(userId);
            if (CollectionUtils.isNotEmpty(roles)) {
                List<String> roleIds = new ArrayList<>();
                for (RoleModel role : roles) {
                    roleIds.add(role.getId());
                }
            }
        }
        return null;
    }

    @ApiOperation(value = "获取招聘顾问" )
    @GetMapping("/getRecruitmentName")
    @ResponseBody
    public List<String> getRecruitmentName(){

        return null;
    }
}
